package medium;

import java.util.*;

/**
 * 创建时间：2025-05-24 16:55
 */
public class 字母异位词分组_49 {
    public List<List<String>> groupAnagrams(String[] strs) {
        Map<String, List<String>> map = new HashMap<>();
        for(String s :strs) {
            char[] cs = s.toCharArray();
            Arrays.sort(cs);
            map.computeIfAbsent(new String(cs), k -> new ArrayList<>()).add(s);
        }
        return new ArrayList<>(map.values());
    }
}
